package parser

import (
	"qweewq.tk/example/crawier/engine"
	"regexp"
)

const zhenaiReg = `<a href="(http://www.zhenai.com/zhenghun/[0-9a-z]+)" data-v-[0-9a-z]+>([^<]+)</a>`

func ParserCityList(content []byte) *engine.ParserResult {
	reg := regexp.MustCompile(zhenaiReg)

	matches := reg.FindAllSubmatch(content, -1)

	var Requests []engine.Request
	var Items []engine.Item

	for _, elem := range matches {
		Requests = append(Requests, engine.Request{
			Url:        string(elem[1]),
			ParserFunc: ParserCityUser,
		})
	}
	return &engine.ParserResult{
		Requests: Requests,
		Items:    Items,
	}
}
